home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: killDiskProcs.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:40 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "list.h"
- #include "tid.h"
- #include "io.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "latch.h"
- #include "bitvec.h"
- #include "disk.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "link.h"
- #include "bf.h"
- #include "pool.h"
- #include "volume.h"
- #include "disk_funcs.h"
- #include "io_globals.h"
- #include "io_extfuncs.h"
-
- static BOOL
- killIt (
- VOLREC *volRec
- )
- {
- /* could be quiescing, in which case it won't have a diskrwPid */
-
- if(volRec->diskrwPid == 0) {
- /* don't use an SM_ASSERT, because that will get us into
- * an infinite loop
- */
- if(volRec->volflags & VOL_OPEN) {
- fprintf(stderr,
- "ASSERTION ERROR @ line %d, file %s volume %d, fd=%d; exiting\n",
- __LINE__,__FILE__, volRec->volid, volRec->queues->semNum);
- exit(1);
- }
- return FALSE;
- }
-
- #ifdef DEBUG
- fprintf(stderr, "killing DISKRW %d\n", volRec->diskrwPid);
- #endif DEBUG
-
- if(kill(volRec->diskrwPid, SIGINT)<0) { /* as if ^C used */
- #ifdef DEBUG
- /*
- * If SIGINT were used to kill the server, the shell
- * also propogated it to the disk processes,
- * in which case we'll get an ESRCH
- * Unfortunately, we don't know if we're now
- * operating on behalf of a SIGINT or not.
- */
- if(errno != ESRCH) {
- fprintf(stderr, "Couldn't kill child %d for volume %s.\n",
- volRec->diskrwPid, volRec->volNameRec->volName.name );
- /*
- * do perror() so you don't get into infinite loop
- * calling SM_Error()
- */
- perror("kill");
- }
- #else DEBUG
- /* oh well. */
- #endif DEBUG
- }
- return FALSE;
- }
-
- void
- killDiskProcs (
- )
- {
- ForEachVolume(1, killIt, 0, 0, 0);
- fprintf(stderr, "All disk processes killed.\n");
- }
-
-